package com.yan01.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

/**
 * @author yyh
 * @create 2020-10-31 10:27
 */
public class NioFileChannel04 {
    public static void main(String[] args) throws Exception{

        FileInputStream fileInputStream = new FileInputStream("1.txt");
        FileOutputStream fileOutputStream = new FileOutputStream("3.txt");

        FileChannel source = fileInputStream.getChannel();
        FileChannel dest = fileOutputStream.getChannel();

        dest.transferFrom(source,0,source.size());

        fileInputStream.close();
        fileOutputStream.close();
    }
}
